/************************************************
 * Copyright (c) 2007 ~ 2009, 
 * All rights reserved.
 * Version   : 1.0
 * Author    : lengsh@gmail.com 
 * Date      : 2009.1.2
 ************************************************/

#ifndef  __SOCKET_CONNECTION__H__
#define  __SOCKET_CONNECTION__H__

#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
#include <string>
#include <iostream>
#include "IConnection.h"

using namespace std;
namespace netproxy {
	class SocketConn : public IConnection
	{
             public:
	//	bool getStatus(int imax );
		SocketConn(const char *hname, int port, int ik, const char *sb ):
			IConnection(hname, port, ik, sb)
		{
		}
		~SocketConn(){   disConnect();     }
		bool Connect();
		bool ReConnect();
		bool CheckBackup(int iMin, int iMax);
		int  GetNextBackup(int &trytimes);
		int Proxy(const char *data, unsigned int dlen, char **wbuf,unsigned &wsize, unsigned &wbytes, bool bReply);
		protected:
		void disConnect();
	};

}
#endif  // __MEMCACHE_CONNECTION__H__
